find first and last positio of element in sorted array